'''
Created on Jun 3, 2010

@author: oabalbin
'''

import sys
import pickle
from collections import deque, defaultdict



def parser_msigdb(inputfile,outfile):
    """
    It parses a file of the molecular signatures database
    """
    concepts_dictionary=defaultdict()
    for line in inputfile:
        if line is None:
            continue 
        if line.startswith('#'):
            continue
        
        fields = line.strip('\n').split('\t')
        concept = fields[0]
        genes_in_concept = fields[2:]
        print concept
        #print genes_in_concept
        concepts_dictionary[concept] = genes_in_concept
        
    #pickle.dump(concepts_dictionary,open(outfile,'w'))
    
    return concepts_dictionary


#parser_msigdb(open('/exds/users/oabalbin/downloads/msigdb.v2.5.symbols.gmt'),'/exds/users/oabalbin/downloads/msigdb.v2.5.symbols.dictionary')